import { ElMessage } from 'element-plus'
const utils={
    isEmpty:(...values)=>{
        if (values === undefined||values.length===0) {
            return true
        }
        for (let value of values) {
            return (value === undefined || value.trim().length === 0);
        }
        return false;
    }/*判空*/,
    isRange:(max,min,...values)=>{
        for (let value of values) {
            return value.length<min||value.length>max;
        }
    }/*是否在范围*/,
    isTitleCase:(...values)=>{
        for (let value of values) {
            return !(/^[A-Z]/.test(value));
        }
    }/*是否首字母大写*/,
    isSpecialCharacters:(...values)=>{
        for (let value of values) {
            return /[^\d\w\s.]+/.test(value)
        }
    }/*是否包含特殊字符*/,
    tipsMessage:(data,code)=>{
        switch (code) {
            case 0:
                ElMessage.success(data);
                break
            case 1:
                ElMessage.info(data);
                break
            case 2:
                ElMessage.warning(data);
                break
            default:
                ElMessage.error(data);
        }


    }
}
export default utils;